// Decompiled by Jad v1.5.8g. Copyright 2001 Pavel Kouznetsov.
// Jad home page: http://www.kpdus.com/jad.html
// Decompiler options: packimports(3) 

package com.sec.android.app.calculator;

import java.math.BigDecimal;
import java.util.Stack;

// Referenced classes of package com.sec.android.app.calculator:
//            CToken, SyntaxException, Cmyfunc, token_type, 
//            Int

class CExpression
{

    CExpression()
    {
        infixStringExp = new StringBuilder();
        infixTokenExp = new CToken[256];
        postfixTokenExp = new CToken[256];
        exception = new SyntaxException();
        inputE = false;
        inputSquare = false;
        Cursor = 0;
        value = 0.0D;
        for(int i = 0; i < 256; i++)
        {
            infixTokenExp[i] = new CToken();
            postfixTokenExp[i] = new CToken();
        }

    }

    public static final double abs(double d)
    {
        return Math.abs(d);
    }

    private void checkingExpression(boolean flag)
        throws SyntaxException
    {
        String s;
        int i;
        int j;
        int k;
        int l;
        int i1;
        int j1;
        int k1;
        boolean flag1;
        boolean flag2;
        boolean flag3;
        boolean flag4;
        boolean flag5;
        boolean flag6;
        boolean flag7;
        boolean flag8;
        boolean flag9;
        boolean flag10;
        boolean flag11;
        int l1;
        s = infixStringExp.toString();
        i = 0;
        j = 0;
        k = 0;
        l = 0;
        i1 = 0;
        j1 = 0;
        k1 = 0;
        flag1 = false;
        flag2 = false;
        flag3 = false;
        flag4 = false;
        flag5 = false;
        flag6 = false;
        flag7 = false;
        flag8 = false;
        flag9 = false;
        flag10 = false;
        flag11 = false;
        Cursor = s.length();
        l1 = 0;
_L15:
        int i2 = s.length();
        if(l1 >= i2) goto _L2; else goto _L1
_L1:
        if(Cmyfunc.isCharSet(s.charAt(l1))) goto _L4; else goto _L3
_L3:
        flag3 = true;
_L2:
        if(flag3 || j < 0)
            throw exception.set(0x7f050001, Cursor);
        break MISSING_BLOCK_LABEL_1431;
_L4:
        if(!Cmyfunc.isDigit(s.charAt(l1)) && s.charAt(l1) != '.') goto _L6; else goto _L5
_L5:
        int k2 = s.length() - 1;
        if(l1 == k2 && s.charAt(l1) == 'E')
            throw exception.set(0x7f050001, l1);
        k++;
        flag11 = true;
        if(k > 15)
        {
            flag4 = true;
        } else
        {
label0:
            {
                if(s.charAt(l1) != '.')
                    break label0;
                k--;
                if(++i1 <= 1 && !s.equals("."))
                    break label0;
                flag3 = true;
            }
        }
          goto _L2
label1:
        {
            if(i != 46)
                break label1;
            flag10 = true;
            if(s.charAt(l1) != 'e' && s.charAt(l1) != '\u03C0')
                break label1;
            flag3 = true;
        }
          goto _L2
label2:
        {
            if(s.charAt(l1) != 'e')
                break MISSING_BLOCK_LABEL_310;
            if(!Cmyfunc.isDigit(i))
                break label2;
            flag3 = true;
        }
          goto _L2
        flag10 = false;
        l = 0;
label3:
        {
            if(s.charAt(l1) == 'E')
            {
                if(!Cmyfunc.isOnlyDigit(i))
                    throw exception.set(0x7f050001, l1 - 1);
                flag10 = false;
                l = 0;
            }
            if(!Cmyfunc.isDigit(s.charAt(l1)) || i != 101 && i != 33 && i != 37 && i != 960)
                break label3;
            flag6 = true;
        }
          goto _L2
        i = s.charAt(l1);
        if(flag10)
            l++;
        if(l <= 10) goto _L8; else goto _L7
_L7:
        flag5 = true;
          goto _L2
_L6:
        i1 = 0;
        flag10 = false;
        k = 0;
        l = 0;
        if(s.charAt(l1) != '(') goto _L10; else goto _L9
_L9:
label4:
        {
            j++;
            if(!Cmyfunc.isDigit(i) && i != 41 && i != 33)
                break label4;
            flag6 = true;
        }
          goto _L2
        if(i == 46)
            throw exception.set(0x7f050016, l1);
          goto _L11
_L10:
        if(s.charAt(l1) != ')') goto _L13; else goto _L12
_L12:
        flag10 = false;
        j--;
        if(!Cmyfunc.isDigit(i) && i != 33 && i != 37 && i != 41 && i != 46) goto _L14; else goto _L8
_L8:
        l1++;
          goto _L15
_L14:
        if(i == 40 || Cmyfunc.isOprator(i))
            flag7 = true;
        else
        if(i == 247)
            flag2 = true;
        else
            flag3 = true;
          goto _L2
_L13:
        if(s.charAt(l1) != '-') goto _L17; else goto _L16
_L16:
        flag10 = false;
        l = 0;
        j1++;
        k1 = l1;
        if(l1 > 0 && i == 8730 || l1 > 1 && i == 40 && s.charAt(l1 - 2) == '\u221A')
            throw exception.set(0x7f050006, Cursor);
        if(!flag && s.contains("log"))
        {
            int k3;
            int l3;
            if(l1 - 3 > 0)
                k3 = l1 - 4;
            else
                k3 = 0;
            l3 = s.indexOf("log", k3);
            if(i == 40 && l3 == l1 - 4 || i == 103 && l3 == l1 - 3)
                throw exception.set(0x7f050006, Cursor);
        }
          goto _L11
_L17:
        if(!Cmyfunc.isChar(s.charAt(l1))) goto _L19; else goto _L18
_L18:
        int i3 = l1;
        do
        {
            int j3 = s.length();
            if(i3 >= j3 || !Cmyfunc.isChar(s.charAt(i3)))
                break;
            i3++;
        } while(true);
        String s1 = s.substring(l1, i3);
        if(!s1.equals("sin") && !s1.equals("cos") && !s1.equals("tan") && !s1.equals("log") && !s1.equals("ln") && !s1.equals("abs"))
            throw exception.set(0x7f050001, l1);
        flag10 = false;
        j1++;
        l = 0;
        l1 += s1.length() - 1;
        k1 = l1;
_L11:
        i = s.charAt(l1);
          goto _L8
_L19:
        if(!Cmyfunc.isToken(s.charAt(l1))) goto _L11; else goto _L20
_L20:
label5:
        {
            flag10 = false;
            if(i == 69)
                throw exception.set(0x7f050001, l1 - 1);
            if(i == 46 && !Cmyfunc.isOpByTwo(s.charAt(l1)))
                throw exception.set(0x7f050001, l1 - 1);
            if(s.charAt(l1) != '^')
                break MISSING_BLOCK_LABEL_1077;
            if(!Cmyfunc.isDigit(i))
                break label5;
            i = s.charAt(l1);
        }
          goto _L8
        if(i == 0)
            throw exception.set(0x7f050001, l1 - 1);
        if(i != 101 && !Cmyfunc.isDigit(i) && (infixStringExp.length() <= l1 + 1 || s.charAt(l1 + 1) == '('))
        {
            int l2 = l1 + 2;
            if(l2 >= s.length())
                flag9 = true;
            else
            if(s.charAt(l2) == '2')
                flag8 = true;
        }
        if(s.charAt(l1) == '!' && (Cmyfunc.isOprator(i) || i == 40 || s.length() == 1))
        {
            Cursor = l1 - 1;
            flag1 = true;
        } else
        {
label6:
            {
                if(s.charAt(l1) == '%')
                {
                    if(!Cmyfunc.isDigit(i) && i != 41 && i != 960 && i != 46)
                        throw exception.set(0x7f050001, l1 - 1);
                    if(l1 + 1 < s.length() && !Cmyfunc.isOprator(s.charAt(l1 + 1)) && s.charAt(l1 + 1) != ')')
                        throw exception.set(0x7f050001, l1);
                }
                if(s.charAt(l1) != '\u221A' || i != 41 && !Cmyfunc.isDigit(i))
                    break label6;
                flag6 = true;
                Cursor = l1 - 1;
            }
        }
          goto _L2
        if(s.charAt(l1) != '!')
        {
            k = 0;
            Cursor = l1;
        }
        if(!Cmyfunc.isOprator(s.charAt(l1))) goto _L22; else goto _L21
_L21:
        i;
        JVM INSTR lookupswitch 3: default 1348
    //                   40: 1395
    //                   94: 1417
    //                   8730: 1417;
           goto _L23 _L24 _L25 _L25
_L23:
        if(Cmyfunc.isOprator(i) || Cmyfunc.isChar(i) && i != 101)
        {
            Cursor = l1 - 1;
            flag7 = true;
        }
_L22:
        flag10 = false;
        j1++;
        k1 = l1;
        l = 0;
          goto _L11
_L24:
        if(s.charAt(l1) == '+' || s.charAt(l1) == '-') goto _L22; else goto _L25
_L25:
        Cursor = l1 - 1;
        flag7 = true;
          goto _L22
        if(flag4)
            throw exception.set(0x7f050002, Cursor);
        if(flag5)
            throw exception.set(0x7f050003, Cursor);
        if(j1 > 20)
        {
            Cursor = k1;
            throw exception.set(0x7f050004, Cursor);
        }
        if(flag1)
            throw exception.set(0x7f050007, Cursor);
        if(flag8)
            throw exception.set(0x7f050007, Cursor);
        if(flag9)
            throw exception.set(0x7f050007, Cursor);
        if(!flag11 && k1 == 0 && i != 40)
            throw exception.set(0x7f050001, Cursor);
        if(flag7)
        {
            if(true);
            throw exception.set(0x7f050001, Cursor);
        }
        for(int j2 = j; j2 > 0; j2--)
            infixStringExp.append(")");

        if(flag6)
            throw exception.set(0x7f050001, Cursor);
        if(flag)
        {
            if(Cmyfunc.isOprator(s.charAt(s.length() - 1)))
                throw exception.set(0x7f050001, Cursor);
        } else
        if(false || Cmyfunc.isOprator(s.charAt(s.length() - 1)) || s.charAt(s.length() - 1) == '-')
            throw exception.set(0x7f050015, Cursor);
        if(flag2)
            throw exception.set(0x7f050007, Cursor);
        return;
          goto _L2
    }

    public static final double cos(double d)
    {
        double d1;
        if(isPiMultiple(Math.toRadians(d) - 1.5707963267948966D))
            d1 = 0.0D;
        else
            d1 = Math.cos(Math.toRadians(d));
        return d1;
    }

    private double evaluateByToken(CToken ctoken, CToken ctoken1, CToken ctoken2)
        throws SyntaxException
    {
        double d;
        double d1;
        d = ctoken1.getTokenValue();
        d1 = ctoken2.getTokenValue();
        class _cls1
        {

            static final int $SwitchMap$com$sec$android$app$calculator$token_type[];

            static 
            {
                $SwitchMap$com$sec$android$app$calculator$token_type = new int[token_type.values().length];
                NoSuchFieldError nosuchfielderror16;
                try
                {
                    $SwitchMap$com$sec$android$app$calculator$token_type[token_type.SQUARE.ordinal()] = 1;
                }
                catch(NoSuchFieldError nosuchfielderror) { }
                try
                {
                    $SwitchMap$com$sec$android$app$calculator$token_type[token_type.MULTI.ordinal()] = 2;
                }
                catch(NoSuchFieldError nosuchfielderror1) { }
                try
                {
                    $SwitchMap$com$sec$android$app$calculator$token_type[token_type.DIVIDE.ordinal()] = 3;
                }
                catch(NoSuchFieldError nosuchfielderror2) { }
                try
                {
                    $SwitchMap$com$sec$android$app$calculator$token_type[token_type.PLUS.ordinal()] = 4;
                }
                catch(NoSuchFieldError nosuchfielderror3) { }
                try
                {
                    $SwitchMap$com$sec$android$app$calculator$token_type[token_type.MINUS.ordinal()] = 5;
                }
                catch(NoSuchFieldError nosuchfielderror4) { }
                try
                {
                    $SwitchMap$com$sec$android$app$calculator$token_type[token_type.ABS.ordinal()] = 6;
                }
                catch(NoSuchFieldError nosuchfielderror5) { }
                try
                {
                    $SwitchMap$com$sec$android$app$calculator$token_type[token_type.PERSENTAGE.ordinal()] = 7;
                }
                catch(NoSuchFieldError nosuchfielderror6) { }
                try
                {
                    $SwitchMap$com$sec$android$app$calculator$token_type[token_type.SIN.ordinal()] = 8;
                }
                catch(NoSuchFieldError nosuchfielderror7) { }
                try
                {
                    $SwitchMap$com$sec$android$app$calculator$token_type[token_type.COS.ordinal()] = 9;
                }
                catch(NoSuchFieldError nosuchfielderror8) { }
                try
                {
                    $SwitchMap$com$sec$android$app$calculator$token_type[token_type.TAN.ordinal()] = 10;
                }
                catch(NoSuchFieldError nosuchfielderror9) { }
                try
                {
                    $SwitchMap$com$sec$android$app$calculator$token_type[token_type.LN.ordinal()] = 11;
                }
                catch(NoSuchFieldError nosuchfielderror10) { }
                try
                {
                    $SwitchMap$com$sec$android$app$calculator$token_type[token_type.LOG.ordinal()] = 12;
                }
                catch(NoSuchFieldError nosuchfielderror11) { }
                try
                {
                    $SwitchMap$com$sec$android$app$calculator$token_type[token_type.ROOT.ordinal()] = 13;
                }
                catch(NoSuchFieldError nosuchfielderror12) { }
                try
                {
                    $SwitchMap$com$sec$android$app$calculator$token_type[token_type.FACT.ordinal()] = 14;
                }
                catch(NoSuchFieldError nosuchfielderror13) { }
                try
                {
                    $SwitchMap$com$sec$android$app$calculator$token_type[token_type.SIGN.ordinal()] = 15;
                }
                catch(NoSuchFieldError nosuchfielderror14) { }
                try
                {
                    $SwitchMap$com$sec$android$app$calculator$token_type[token_type.OPERAND.ordinal()] = 16;
                }
                catch(NoSuchFieldError nosuchfielderror15) { }
                $SwitchMap$com$sec$android$app$calculator$token_type[token_type.RPARAM.ordinal()] = 17;
_L2:
                return;
                nosuchfielderror16;
                if(true) goto _L2; else goto _L1
_L1:
            }
        }

        _cls1..SwitchMap.com.sec.android.app.calculator.token_type[ctoken.getTokenType().ordinal()];
        JVM INSTR tableswitch 1 5: default 56
    //                   1 64
    //                   2 76
    //                   3 97
    //                   4 121
    //                   5 142;
           goto _L1 _L2 _L3 _L4 _L5 _L6
_L1:
        double d2 = -1D;
_L8:
        return d2;
_L2:
        d2 = Math.pow(d, d1);
        continue; /* Loop/switch isn't completed */
_L3:
        d2 = BigDecimal.valueOf(d).multiply(BigDecimal.valueOf(d1)).doubleValue();
        continue; /* Loop/switch isn't completed */
_L4:
        d2 = BigDecimal.valueOf(d).divide(BigDecimal.valueOf(d1), 11, 4).doubleValue();
        continue; /* Loop/switch isn't completed */
_L5:
        d2 = BigDecimal.valueOf(d).add(BigDecimal.valueOf(d1)).doubleValue();
        continue; /* Loop/switch isn't completed */
_L6:
        d2 = BigDecimal.valueOf(d).subtract(BigDecimal.valueOf(d1)).doubleValue();
        if(true) goto _L8; else goto _L7
_L7:
    }

    private double evaluateByTokenOne(CToken ctoken, CToken ctoken1)
        throws SyntaxException
    {
        double d;
        d = setRounds(ctoken1.getTokenValue());
        Cursor = infixStringExp.length();
        _cls1..SwitchMap.com.sec.android.app.calculator.token_type[ctoken.getTokenType().ordinal()];
        JVM INSTR tableswitch 6 15: default 84
    //                   6 92
    //                   7 101
    //                   8 110
    //                   9 123
    //                   10 136
    //                   11 149
    //                   12 195
    //                   13 224
    //                   14 285
    //                   15 341;
           goto _L1 _L2 _L3 _L4 _L5 _L6 _L7 _L8 _L9 _L10 _L11
_L1:
        double d1 = -1D;
_L13:
        return d1;
_L2:
        d1 = abs(d);
        continue; /* Loop/switch isn't completed */
_L3:
        d1 = persentage(d);
        continue; /* Loop/switch isn't completed */
_L4:
        d1 = setRounds(sin(d));
        continue; /* Loop/switch isn't completed */
_L5:
        d1 = setRounds(cos(d));
        continue; /* Loop/switch isn't completed */
_L6:
        d1 = setRounds(tan(d));
        continue; /* Loop/switch isn't completed */
_L7:
        if(inputE && inputSquare)
        {
            inputE = false;
            inputSquare = false;
            d1 = setRounds(Math.log(d));
        } else
        {
            d1 = Math.log(d);
        }
        continue; /* Loop/switch isn't completed */
_L8:
        if(d < 0.0D)
            throw exception.set(0x7f050006, Cursor);
        d1 = Math.log10(d);
        continue; /* Loop/switch isn't completed */
_L9:
        if(d < 0.0D)
            throw exception.set(0x7f050006, Cursor);
        if(Double.parseDouble(String.valueOf((int)d)) != d)
            d1 = setRounds(Math.sqrt(ctoken1.getTokenValue()));
        else
            d1 = Math.sqrt(ctoken1.getTokenValue());
        continue; /* Loop/switch isn't completed */
_L10:
        String s = Double.toString(d);
        if(s.contains(".") && s.charAt(s.length() - 1) != '0')
            throw exception.set(0x7f050006, Cursor);
        d1 = factorial(d);
        continue; /* Loop/switch isn't completed */
_L11:
        d1 = d * ctoken.getTokenValue();
        if(true) goto _L13; else goto _L12
_L12:
    }

    public static final double factorial(double d)
    {
        if(d >= 0.0D) goto _L2; else goto _L1
_L1:
        double d2 = (0.0D / 0.0D);
_L4:
        return d2;
_L2:
        if(d > 170D)
        {
            d2 = Math.exp(lgamma(d));
            continue; /* Loop/switch isn't completed */
        }
        if(Math.floor(d) == d)
            break; /* Loop/switch isn't completed */
        d2 = Math.exp(lgamma(d));
        if(true) goto _L4; else goto _L3
_L3:
        int i = (int)d;
        double d1 = d;
        switch(i & 7)
        {
        default:
            d2 = Math.exp(lgamma(d));
            break;

        case 7: // '\007'
            d--;
            d1 *= d;
            // fall through

        case 6: // '\006'
            d--;
            d1 *= d;
            // fall through

        case 5: // '\005'
            d--;
            d1 *= d;
            // fall through

        case 4: // '\004'
            d--;
            d1 *= d;
            // fall through

        case 3: // '\003'
            d--;
            d1 *= d;
            // fall through

        case 2: // '\002'
            d1 *= d - 1.0D;
            // fall through

        case 1: // '\001'
            d2 = d1 * FACT[i >> 3];
            break;

        case 0: // '\0'
            d2 = FACT[i >> 3];
            break;
        }
        if(true) goto _L4; else goto _L5
_L5:
    }

    private CToken getToken(Int int1, int i)
    {
        CToken ctoken;
        char c;
        ctoken = new CToken();
        for(; Cmyfunc.isSpace(infixStringExp.charAt(int1.data)); int1.data = 1 + int1.data);
        c = infixStringExp.charAt(int1.data);
        if(c != 'e') goto _L2; else goto _L1
_L1:
        ctoken.setTokenType(token_type.OPERAND);
        ctoken.setTokenValue(2.71828182845905D);
        int1.data = 1 + int1.data;
_L9:
        return ctoken;
_L2:
        if(c == '\u03C0')
        {
            ctoken.setTokenType(token_type.OPERAND);
            ctoken.setTokenValue(setRounds(3.14159265358979D));
            int1.data = 1 + int1.data;
            continue; /* Loop/switch isn't completed */
        }
        if(c == '-')
        {
            if(!isSign(int1, i))
            {
                ctoken.setTokenType(token_type.MINUS);
                int1.data = 1 + int1.data;
            } else
            {
                int i1;
                for(i1 = 1 + int1.data; i1 < infixStringExp.length() && (Cmyfunc.isDigit(infixStringExp.charAt(i1)) || infixStringExp.charAt(i1) == '.'); i1++);
                String s2 = infixStringExp.substring(1 + int1.data, i1).replaceAll(",", "");
                if(s2.equals(""))
                {
                    ctoken.setTokenType(token_type.SIGN);
                    ctoken.setTokenValue(-1D);
                    int1.data = i1;
                } else
                {
                    if(s2.equals("e"))
                        value = -2.71828182845905D;
                    else
                    if(s2.equals("\u03C0"))
                    {
                        value = -3.14159265358979D;
                    } else
                    {
                        value = Double.valueOf(s2).doubleValue();
                        value = -1D * value;
                    }
                    ctoken.setTokenType(token_type.OPERAND);
                    ctoken.setTokenValue(value);
                    int1.data = i1;
                }
            }
            continue; /* Loop/switch isn't completed */
        }
        if(c == '+')
        {
            if(!isSign(int1, i))
            {
                ctoken.setTokenType(token_type.PLUS);
                int1.data = 1 + int1.data;
            } else
            {
                int l;
                for(l = 1 + int1.data; l < infixStringExp.length() && (Cmyfunc.isDigit(infixStringExp.charAt(l)) || infixStringExp.charAt(l) == '.'); l++);
                if(l == 1 + int1.data)
                {
                    ctoken.setTokenType(token_type.ENDMARKER);
                    int1.data = 1 + int1.data;
                } else
                {
                    String s1 = infixStringExp.substring(1 + int1.data, l).replaceAll(",", "");
                    if(s1.equals(""))
                    {
                        ctoken.setTokenType(token_type.SIGN);
                        ctoken.setTokenValue(-1D);
                        int1.data = l;
                    } else
                    {
                        if(s1.equals("e"))
                            value = 2.71828182845905D;
                        else
                        if(s1.equals("\u03C0"))
                            value = 3.14159265358979D;
                        else
                            value = Double.valueOf(s1).doubleValue();
                        ctoken.setTokenType(token_type.OPERAND);
                        ctoken.setTokenValue(value);
                        int1.data = l;
                    }
                }
            }
            continue; /* Loop/switch isn't completed */
        }
        if(Cmyfunc.isChar(c))
        {
            int k;
            for(k = 1 + int1.data; k < infixStringExp.length() && Cmyfunc.isChar(infixStringExp.charAt(k)); k++);
            String s = infixStringExp.substring(int1.data, k).replaceAll(",", "");
            int1.data = 3 + int1.data;
            if(s.equals("sin"))
                ctoken.setTokenType(token_type.SIN);
            else
            if(s.equals("cos"))
                ctoken.setTokenType(token_type.COS);
            else
            if(s.equals("tan"))
                ctoken.setTokenType(token_type.TAN);
            else
            if(s.equals("log"))
                ctoken.setTokenType(token_type.LOG);
            else
            if(s.equals("abs"))
                ctoken.setTokenType(token_type.ABS);
            else
            if(s.equals("ln"))
            {
                ctoken.setTokenType(token_type.LN);
                int1.data = int1.data - 1;
            } else
            {
                int1.data = int1.data - 3;
            }
            continue; /* Loop/switch isn't completed */
        }
        if(c != ')') goto _L4; else goto _L3
_L3:
        ctoken.setTokenType(token_type.RPARAM);
_L6:
        int1.data = 1 + int1.data;
        continue; /* Loop/switch isn't completed */
_L4:
        if(c != '(')
            break; /* Loop/switch isn't completed */
        ctoken.setTokenType(token_type.LPARAM);
        if(true) goto _L6; else goto _L5
_L5:
        int j;
        if(Cmyfunc.isToken(c))
        {
            switch(c)
            {
            case 0: // '\0'
                ctoken.setTokenType(token_type.EOS);
                break;

            case 215: 
                ctoken.setTokenType(token_type.MULTI);
                break;

            case 247: 
                ctoken.setTokenType(token_type.DIVIDE);
                break;

            case 43: // '+'
                ctoken.setTokenType(token_type.PLUS);
                break;

            case 45: // '-'
                ctoken.setTokenType(token_type.MINUS);
                break;

            case 94: // '^'
                ctoken.setTokenType(token_type.SQUARE);
                break;

            case 8730: 
                ctoken.setTokenType(token_type.ROOT);
                break;

            case 37: // '%'
                ctoken.setTokenType(token_type.PERSENTAGE);
                break;

            case 33: // '!'
                ctoken.setTokenType(token_type.FACT);
                break;
            }
        } else
        {
            for(j = 1 + int1.data; j < infixStringExp.length() && (Cmyfunc.isDigit(infixStringExp.charAt(j)) || infixStringExp.charAt(j) == '.' || infixStringExp.charAt(j) == 'E' || infixStringExp.charAt(j) == ',' || infixStringExp.charAt(j) == '-' && infixStringExp.charAt(j - 1) == 'E'); j++);
            value = Double.valueOf(infixStringExp.substring(int1.data, j).replaceAll(",", "")).doubleValue();
            ctoken.setTokenType(token_type.OPERAND);
            ctoken.setTokenValue(value);
            break MISSING_BLOCK_LABEL_1241;
        }
        if(true) goto _L6; else goto _L7
_L7:
        int1.data = j;
        if(true) goto _L9; else goto _L8
_L8:
    }

    private void infix2postfix()
    {
        int i;
        Stack stack;
        int ai[];
        int ai1[];
        CToken ctoken1;
        int k;
        i = 0;
        stack = new Stack();
        CToken ctoken = new CToken();
        new CToken();
        ai = new int[20];
        ai[0] = 0;
        ai[1] = 20;
        ai[2] = 18;
        ai[3] = 18;
        ai[4] = 18;
        ai[5] = 18;
        ai[6] = 18;
        ai[7] = 18;
        ai[8] = 18;
        ai[9] = 18;
        ai[10] = 18;
        ai[11] = 18;
        ai[12] = 17;
        ai[13] = 16;
        ai[14] = 16;
        ai[15] = 15;
        ai[16] = 15;
        ai[17] = 14;
        ai[18] = 13;
        ai[19] = 0;
        ai1 = new int[20];
        ai1[0] = 21;
        ai1[1] = 20;
        ai1[2] = 18;
        ai1[3] = 18;
        ai1[4] = 18;
        ai1[5] = 18;
        ai1[6] = 18;
        ai1[7] = 18;
        ai1[8] = 18;
        ai1[9] = 18;
        ai1[10] = 18;
        ai1[11] = 18;
        ai1[12] = 17;
        ai1[13] = 16;
        ai1[14] = 16;
        ai1[15] = 15;
        ai1[16] = 15;
        ai1[17] = 14;
        ai1[18] = 13;
        ai1[19] = 0;
        ctoken.setTokenType(token_type.EOS);
        stack.push(ctoken);
        CToken actoken[] = infixTokenExp;
        int j = 0 + 1;
        ctoken1 = actoken[0];
        k = j;
_L6:
        if(ctoken1.getTokenType() == token_type.EOS) goto _L2; else goto _L1
_L1:
        _cls1..SwitchMap.com.sec.android.app.calculator.token_type[ctoken1.getTokenType().ordinal()];
        JVM INSTR tableswitch 16 17: default 384
    //                   16 450
    //                   17 496;
           goto _L3 _L4 _L5
_L3:
        CToken ctoken4;
        for(ctoken4 = (CToken)stack.pop(); ai[ctoken4.getTokenType().ordinal()] >= ai1[ctoken1.getTokenType().ordinal()];)
        {
            CToken actoken5[] = postfixTokenExp;
            int l1 = i + 1;
            actoken5[i] = ctoken4;
            ctoken4 = (CToken)stack.pop();
            i = l1;
        }

        break MISSING_BLOCK_LABEL_548;
_L4:
        CToken actoken4[] = postfixTokenExp;
        int k1 = i + 1;
        actoken4[i] = ctoken1;
        i = k1;
_L7:
        CToken actoken3[] = infixTokenExp;
        int j1 = k + 1;
        ctoken1 = actoken3[k];
        k = j1;
          goto _L6
_L5:
        CToken ctoken3 = (CToken)stack.pop();
        while(ctoken3.getTokenType() != token_type.LPARAM) 
        {
            CToken actoken2[] = postfixTokenExp;
            int i1 = i + 1;
            actoken2[i] = ctoken3;
            ctoken3 = (CToken)stack.pop();
            i = i1;
        }
          goto _L7
        stack.push(ctoken4);
        stack.push(ctoken1);
          goto _L7
_L9:
        CToken ctoken2;
        CToken actoken1[] = postfixTokenExp;
        int l = i + 1;
        actoken1[i] = ctoken2;
        i = l;
_L2:
        if(stack.empty())
            break; /* Loop/switch isn't completed */
        ctoken2 = (CToken)stack.pop();
        if(ctoken2.getTokenType() != token_type.EOS) goto _L9; else goto _L8
_L8:
    }

    private static final boolean isPiMultiple(double d)
    {
        double d1 = d / 3.1415926535897931D;
        boolean flag;
        if(d1 == Math.floor(d1))
            flag = true;
        else
            flag = false;
        return flag;
    }

    private boolean isSign(Int int1, int i)
    {
        boolean flag;
        if(int1.data != 0 && (Cmyfunc.isDigit(infixStringExp.charAt(int1.data - 1)) || infixStringExp.charAt(int1.data - 1) == ')' || infixStringExp.charAt(int1.data - 1) == '!' || infixStringExp.charAt(int1.data - 1) == '%' || infixStringExp.charAt(int1.data - 1) == '.'))
            flag = false;
        else
            flag = true;
        return flag;
    }

    public static final double lgamma(double d)
    {
        double d1 = d + 5.2421875D;
        double d2 = 0.99999999999999711D;
        for(int i = 0; i < GAMMA.length; i++)
        {
            double d3 = GAMMA[i];
            d++;
            d2 += d3 / d;
        }

        return (0.91893853320467278D + Math.log(d2) + (d1 - 4.7421875D) * Math.log(d1)) - d1;
    }

    public static final double persentage(double d)
    {
        return d / 100D;
    }

    private double setRounds(double d)
    {
        return setRounds(d, 10);
    }

    private double setRounds(double d, int i)
    {
        String s = Double.toString(Math.abs(d));
        StringBuffer stringbuffer = new StringBuffer(s);
        int j = s.lastIndexOf('E');
        String s1;
        int k;
        int l;
        if(j != -1)
            s1 = s.substring(j + 1);
        else
            s1 = "";
        if(j != -1)
            stringbuffer.setLength(j);
        k = stringbuffer.length();
        for(l = 0; l < k && stringbuffer.charAt(l) != '.'; l++);
        int i1 = 0 + l;
        if(l < k)
        {
            stringbuffer.deleteCharAt(l);
            k--;
        }
        int j1 = i + i1;
        int k1;
        if(j1 < k)
        {
            if(stringbuffer.charAt(j1) >= '5')
            {
                int k3;
                for(k3 = j1 - 1; k3 >= 0 && stringbuffer.charAt(k3) == '9'; k3--)
                    stringbuffer.setCharAt(k3, '0');

                int l1;
                int j2;
                int k2;
                if(k3 >= 0)
                {
                    int l3 = 1 + stringbuffer.charAt(k3);
                    stringbuffer.setCharAt(k3, l3);
                } else
                {
                    stringbuffer.insert(0, '1');
                    j1++;
                    i1++;
                }
            }
            stringbuffer.setLength(j1);
        }
        if(i1 < -5 || i1 > 15)
        {
            stringbuffer.insert(1, '.');
            int _tmp = i1 - 1;
        } else
        {
            for(int l2 = k; l2 < i1; l2++)
                stringbuffer.append('0');

            for(int i3 = i1; i3 <= 0; i3++)
                stringbuffer.insert(0, '0');

            int j3;
            if(i1 <= 0)
                j3 = 1;
            else
                j3 = i1;
            stringbuffer.insert(j3, '.');
        }
        k1 = stringbuffer.length();
        l1 = k1 - l - 1;
        if(l1 > 10)
        {
            j2 = l1 - 10;
            for(k2 = 0; k2 < j2; k2++)
                stringbuffer.setCharAt(1 + (k2 + (l + 10)), '0');

        }
        int i2;
        for(i2 = k1 - 1; i2 >= 0 && stringbuffer.charAt(i2) == '0'; i2--)
            stringbuffer.deleteCharAt(i2);

        if(i2 >= 0 && stringbuffer.charAt(i2) == '.')
            stringbuffer.deleteCharAt(i2);
        if(s1.length() > 0)
            stringbuffer.append('E').append(s1);
        if(d < 0.0D)
            stringbuffer.insert(0, '-');
        return Double.valueOf(stringbuffer.toString()).doubleValue();
    }

    public static final double sin(double d)
    {
        double d1;
        if(isPiMultiple(Math.toRadians(d)))
            d1 = 0.0D;
        else
            d1 = Math.sin(Math.toRadians(d));
        return d1;
    }

    public static final double tan(double d)
    {
        double d1;
        if(Math.abs(d) % 180D == 90D)
            d1 = (1.0D / 0.0D);
        else
        if(isPiMultiple(Math.toRadians(d)))
            d1 = 0.0D;
        else
            d1 = Math.tan(Math.toRadians(d));
        return d1;
    }

    public boolean checkInputExp(StringBuilder stringbuilder, boolean flag)
        throws SyntaxException
    {
        int i = 0;
        while(i < stringbuilder.length()) 
        {
            if(stringbuilder.charAt(i) == '\n' || stringbuilder.charAt(i) == ' ')
                infixStringExp.append("");
            else
            if(stringbuilder.charAt(i) != ',')
            {
                if(stringbuilder.charAt(i) == '-' && (i == 0 || i != 0 && stringbuilder.charAt(i - 1) == '('))
                    infixStringExp.append('0');
                infixStringExp.append(stringbuilder.charAt(i));
            }
            i++;
        }
        checkingExpression(flag);
        if(!flag)
            break MISSING_BLOCK_LABEL_130;
        transInfixStringExp2TokenExp();
        infix2postfix();
        boolean flag1 = true;
_L2:
        return flag1;
        Exception exception1;
        exception1;
        flag1 = false;
        if(true) goto _L2; else goto _L1
_L1:
    }

    public String evaluateExp()
        throws SyntaxException
    {
        Stack stack;
        CToken ctoken1;
        int j;
        stack = new Stack();
        CToken ctoken = new CToken();
        ctoken.setTokenType(token_type.EOS);
        stack.push(ctoken);
        CToken actoken[] = postfixTokenExp;
        int i = 0 + 1;
        ctoken1 = actoken[0];
        inputE = false;
        inputSquare = false;
        j = i;
_L2:
        if(ctoken1.getTokenType() == token_type.EOS)
            break MISSING_BLOCK_LABEL_287;
        switch(_cls1..SwitchMap.com.sec.android.app.calculator.token_type[ctoken1.getTokenType().ordinal()])
        {
        default:
            if(ctoken1.getTokenType() == token_type.SQUARE)
                inputSquare = true;
            CToken ctoken2 = (CToken)stack.pop();
            double d1 = evaluateByToken(ctoken1, (CToken)stack.pop(), ctoken2);
            stack.push(new CToken(token_type.OPERAND, d1));
            break;

        case 6: // '\006'
        case 7: // '\007'
        case 8: // '\b'
        case 9: // '\t'
        case 10: // '\n'
        case 11: // '\013'
        case 12: // '\f'
        case 13: // '\r'
        case 14: // '\016'
        case 15: // '\017'
            break MISSING_BLOCK_LABEL_252;

        case 16: // '\020'
            break; /* Loop/switch isn't completed */
        }
_L3:
        CToken actoken1[] = postfixTokenExp;
        int k = j + 1;
        ctoken1 = actoken1[j];
        j = k;
        if(true) goto _L2; else goto _L1
_L1:
        if(ctoken1.getTokenValue() == 2.71828182845905D)
            inputE = true;
        stack.push(ctoken1);
          goto _L3
        double d = evaluateByTokenOne(ctoken1, (CToken)stack.pop());
        stack.push(new CToken(token_type.OPERAND, d));
          goto _L3
        value = ((CToken)stack.pop()).getTokenValue();
        return Double.toString(value);
    }

    public void transInfixStringExp2TokenExp()
    {
        Int int1 = new Int();
        int i = 0;
        new CToken();
        int1.data = 0;
        do
        {
            if(int1.data >= infixStringExp.length())
                break;
            CToken ctoken = getToken(int1, 0);
            if(int1.data == 0 && Cmyfunc.getmOrigin().length() > 0)
                ctoken.setTokenValue(Double.valueOf(Cmyfunc.getmTrans()).doubleValue());
            if(ctoken.getTokenType() != token_type.ENDMARKER)
            {
                infixTokenExp[i] = ctoken;
                i++;
            }
        } while(true);
    }

    static final double FACT[];
    static final double GAMMA[];
    int Cursor;
    private SyntaxException exception;
    private StringBuilder infixStringExp;
    private CToken infixTokenExp[];
    private boolean inputE;
    private boolean inputSquare;
    private CToken postfixTokenExp[];
    private double value;

    static 
    {
        double ad[] = new double[14];
        ad[0] = 57.156235665862923D;
        ad[1] = -59.597960355475493D;
        ad[2] = 14.136097974741746D;
        ad[3] = -0.49191381609762019D;
        ad[4] = 3.3994649984811891E-005D;
        ad[5] = 4.6523628927048578E-005D;
        ad[6] = -9.8374475304879565E-005D;
        ad[7] = 0.00015808870322491249D;
        ad[8] = -0.00021026444172410488D;
        ad[9] = 0.00021743961811521265D;
        ad[10] = -0.00016431810653676389D;
        ad[11] = 8.441822398385275E-005D;
        ad[12] = -2.6190838401581408E-005D;
        ad[13] = 3.6899182659531625E-006D;
        GAMMA = ad;
        double ad1[] = new double[22];
        ad1[0] = 1.0D;
        ad1[1] = 40320D;
        ad1[2] = 20922789888000D;
        ad1[3] = 6.2044840173323941E+023D;
        ad1[4] = 2.6313083693369352E+035D;
        ad1[5] = 8.1591528324789768E+047D;
        ad1[6] = 1.2413915592536073E+061D;
        ad1[7] = 7.1099858780486348E+074D;
        ad1[8] = 1.2688693218588417E+089D;
        ad1[9] = 6.1234458376886085E+103D;
        ad1[10] = 7.1569457046263806E+118D;
        ad1[11] = 1.8548264225739844E+134D;
        ad1[12] = 9.9167793487094965E+149D;
        ad1[13] = 1.0299016745145628E+166D;
        ad1[14] = 1.974506857221074E+182D;
        ad1[15] = 6.6895029134491271E+198D;
        ad1[16] = 3.8562048236258041E+215D;
        ad1[17] = 3.6590428819525489E+232D;
        ad1[18] = 5.5502938327393044E+249D;
        ad1[19] = 1.3113358856834524E+267D;
        ad1[20] = 4.7147236359920616E+284D;
        ad1[21] = 2.5260757449731984E+302D;
        FACT = ad1;
    }
}
